UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7+lulOgDovUxT+7gYqwWxtjsgAPDGL887dYpV2iz4q8=' 
WHERE 
  key_id = '32100b67b5982d93b6f8547b8f28c2cac4b73a46eabb83ba74c833675d8f94a5' 
  AND (
    token = '7+lulOgDovUxT+7gYqwWxtjsgAPDGL887dYpV2iz4q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030