UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DLQ74P2rNr3Vuilmn9Eg7uwze4mzgTEXVQBj01PHZQ8=' 
WHERE 
  key_id = '7a4a97563662aeb880b3bd71ea02f754cae9cdc5bab39727e85e1446a12a85e6' 
  AND (
    token = 'DLQ74P2rNr3Vuilmn9Eg7uwze4mzgTEXVQBj01PHZQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029