UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UFXkS2v/DwRVZZW0vMceVmFD457tmese5fjSN+hYUF4=' 
WHERE 
  key_id = 'f2fa6e227882a7b3a55113e54db3edfea78a7f1af9ce5fc69a67678bc647ca4f' 
  AND (
    token = 'UFXkS2v/DwRVZZW0vMceVmFD457tmese5fjSN+hYUF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048