UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UtTV9sa5ZCmZY1d0jp+4IHiJEvgRhOzCeNfDh47FNlQ=' 
WHERE 
  key_id = '1e6fa8148a289032495ae222c7dfbc5cd372602edd358468cd4fa888f779e5e1' 
  AND (
    token = 'UtTV9sa5ZCmZY1d0jp+4IHiJEvgRhOzCeNfDh47FNlQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028