UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mTDq/rBjANG/ptPfrFn8ukdcgSzn9cxuSJIpkY8Xoos=' 
WHERE 
  key_id = 'd2a79ccbe99a84b7735649fbdbef5c41fa94566248165cd16e5c61b0ee2a91ea' 
  AND (
    token = 'mTDq/rBjANG/ptPfrFn8ukdcgSzn9cxuSJIpkY8Xoos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030