UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4aIBouzeHV39wNphMZeUlCtadsn62En/6ZiyZSrt7a8=' 
WHERE 
  key_id = '54199eaefcd5dc990a32e52e944f8c4cb3c4e32d2bb056057bab9b6f29b77409' 
  AND (
    token = '4aIBouzeHV39wNphMZeUlCtadsn62En/6ZiyZSrt7a8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054