UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UkRtFhk4au8fdbXJgtCRTwLhRAM5j3ocQpIcQkD+ao0=' 
WHERE 
  key_id = 'aff7e934aa7d493bb1126351c9efe463d71ec0ae37574d607485e90984829880' 
  AND (
    token = 'UkRtFhk4au8fdbXJgtCRTwLhRAM5j3ocQpIcQkD+ao0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025