UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SQP3guOeMH341+Sus7/jNW0QNRQs4C5zb+LrfvK+CvM=' 
WHERE 
  key_id = '3024d4374a8953a98b236713a29db761c9885480681983197acfae9f3b9f0945' 
  AND (
    token = 'SQP3guOeMH341+Sus7/jNW0QNRQs4C5zb+LrfvK+CvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023