UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mHAdHVS58kmrkkSX2EMGr6TQiRGknadOtp0kOyfB0R0=' 
WHERE 
  key_id = '9289918afca9ab5c07ed199166679aa85ad0144c6028421c279399bd5393777e' 
  AND (
    token = 'mHAdHVS58kmrkkSX2EMGr6TQiRGknadOtp0kOyfB0R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027