UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gtC51yjtC3yRjhcjHwy1/hw3+p/y6qhzDpWpVPEU6nc=' 
WHERE 
  key_id = '6156150af228b99d484c2c87ea2c3cead620f45fab99a1aea42ffdf964f7f453' 
  AND (
    token = 'gtC51yjtC3yRjhcjHwy1/hw3+p/y6qhzDpWpVPEU6nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034