UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XkKe2p2cVsGdhSAh9mHvBLlTy7cN6ezu9JzUUNiLI6o=' 
WHERE 
  key_id = '941fec76dbb1822e91b519adc804d3a80107899c786acdb55c9c3e69f3105501' 
  AND (
    token = 'XkKe2p2cVsGdhSAh9mHvBLlTy7cN6ezu9JzUUNiLI6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00283