UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'soXBCiOPoymymquXzp1Bq3g4yXvRkmmvTGDMZ35gkeI=' 
WHERE 
  key_id = '173f0d5420ff06bcd0e7e46d1af185217294a3da18274d4b442804721662da53' 
  AND (
    token = 'soXBCiOPoymymquXzp1Bq3g4yXvRkmmvTGDMZ35gkeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041