UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iGhY0u2ErQx+pGLczneQ4XDt91tpAOhTaCEzWKMjoCM=' 
WHERE 
  key_id = '6a93c09718405498c6258218e1c2e737106d461ee8c27972249e0c1a021b2908' 
  AND (
    token = 'iGhY0u2ErQx+pGLczneQ4XDt91tpAOhTaCEzWKMjoCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036