UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+oHeLfGE+nCVRjFCgFW+Hy2wFyks7jObmAJtu/9HMM=' 
WHERE 
  key_id = 'a1e5041af28c834bff84a9168174d0688241a2462107bb6bdd2217a180fbfd0f' 
  AND (
    token = 'L+oHeLfGE+nCVRjFCgFW+Hy2wFyks7jObmAJtu/9HMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027