UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lpt0nDzPCyZt7pO5R6mB/zLz6fJ9+Vevb4SuMTe4nZo=' 
WHERE 
  key_id = '3a94b689c49f7c2e5197c4de6ee098b9dc0502985ff2940744d501db9ce36313' 
  AND (
    token = 'Lpt0nDzPCyZt7pO5R6mB/zLz6fJ9+Vevb4SuMTe4nZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030