UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TI+wCqdStcnuRL+Nu8RRHCYMg7HVUU2xpriJWcGOmiA=' 
WHERE 
  key_id = '9cef6d7e384ffd851a9ac0febde25dc7e6c2128a35916d72204d0d0e16968a94' 
  AND (
    token = 'TI+wCqdStcnuRL+Nu8RRHCYMg7HVUU2xpriJWcGOmiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044