UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ec+YW18JuR/e7DNixXJvgBgqL8HwmXGsKORAdCOWGF8=' 
WHERE 
  key_id = 'cf5040e167fb1ce8b857789081b7f34a9bd2a9c7d279c9f6d6737b562152724e' 
  AND (
    token = 'Ec+YW18JuR/e7DNixXJvgBgqL8HwmXGsKORAdCOWGF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028