UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rhv1qE3/MrSqJck+5twNenUns/Syu0+huqFKuysTufk=' 
WHERE 
  key_id = '689fff5e30a78b0faf9c9ff2db507dc349a98e2d337846f3d8f9cc2c4457e775' 
  AND (
    token = 'rhv1qE3/MrSqJck+5twNenUns/Syu0+huqFKuysTufk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036