UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tfP3wPvwsAwjrdr/SHunYvq+R9HoTIfTaVx16fbvxL4=' 
WHERE 
  key_id = '54a1b6dd8f68b16770b2559375e199584344572ebab44609ae2bdedd31e8e9b6' 
  AND (
    token = 'tfP3wPvwsAwjrdr/SHunYvq+R9HoTIfTaVx16fbvxL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046