UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhdjyxch/g1UeKX2EnmUm5IJEogaHh207ZPaByEbagA=' 
WHERE 
  key_id = 'b9baf303a5e8b71a2c909934010e27a9300f2a674263f83ac68f0b0f751418b0' 
  AND (
    token = 'fhdjyxch/g1UeKX2EnmUm5IJEogaHh207ZPaByEbagA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026