UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sa7EN+/Q0Fi35V0KP9XBxmreC9ybpcCiHmTrZ3YEt10=' 
WHERE 
  key_id = 'ecb666216f1baa8329ac381d5d205060a7ab1ec40d2494ba094f0227ad4ff20f' 
  AND (
    token = 'Sa7EN+/Q0Fi35V0KP9XBxmreC9ybpcCiHmTrZ3YEt10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026