UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YIJg4wyFhWtQ11qx/+/3Ak5TfwDi5C8oiRlUlon5D+4=' 
WHERE 
  key_id = 'c42aa8c17f4ea829e57de1ded9b6c9a97e9e0fcd98b72fb57f98b55f9f0acd46' 
  AND (
    token = 'YIJg4wyFhWtQ11qx/+/3Ak5TfwDi5C8oiRlUlon5D+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018