UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yo8NQ/OKHyddE/49Ff0ubw/3FjZfxsMkc1V/e5aNkoo=' 
WHERE 
  key_id = 'e51fc96ae7aec9f04bda4337e65eff6ed29920063040e6a86a41ef536241537d' 
  AND (
    token = 'Yo8NQ/OKHyddE/49Ff0ubw/3FjZfxsMkc1V/e5aNkoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032