UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DJ5Q1eb7/Vi6pLA9lll336rnhu9mT+jrmd2G642Qx8k=' 
WHERE 
  key_id = 'b13c959992434690bfb718a331890e7c9c342bc5bf086aab4515ce2d7bad38f1' 
  AND (
    token = 'DJ5Q1eb7/Vi6pLA9lll336rnhu9mT+jrmd2G642Qx8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025