UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fcX6jvUY2jsu8ib7Rmoe2kToHmDms1FFuij4tagMCEQ=' 
WHERE 
  key_id = '47afe6dbc875e60b3e932603368bb69068643504c8fb3e8e9be003653ebd5ef5' 
  AND (
    token = 'fcX6jvUY2jsu8ib7Rmoe2kToHmDms1FFuij4tagMCEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034