UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kx2Ey9KAAtwjOzPXalRfsVrPPqCuJ1DUWXmrR+uWyZM=' 
WHERE 
  key_id = '5bf43d6db570292b578f5eff2fb671aeae41a953999d38a4c6b308fbd9cf3c39' 
  AND (
    token = 'Kx2Ey9KAAtwjOzPXalRfsVrPPqCuJ1DUWXmrR+uWyZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051