UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4EBssYNhT3SDYiPfTK1lCh8tszceFtsFyB8v+NXgOMQ=' 
WHERE 
  key_id = '120475318dca013ddf3572afe822ce81b374692f98b2faaf5cec18a59333a24c' 
  AND (
    token = '4EBssYNhT3SDYiPfTK1lCh8tszceFtsFyB8v+NXgOMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026