UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YCYFxtggMgTqt/+YVfy1Xu8kFPDbqlfBwjexdyE4pQ4=' 
WHERE 
  key_id = '593521665da9d093a768a621cdf2b89087e7a45378336b4e8d897b6687d2980a' 
  AND (
    token = 'YCYFxtggMgTqt/+YVfy1Xu8kFPDbqlfBwjexdyE4pQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016