UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ILp2DwfmY8DXnY5KC1Q+RoZWaNxmyODVj1Iu/yOsdLs=' 
WHERE 
  key_id = 'ad55ddc6aca8e68a24e556f2ec19489e7300efa8e889dc3ff960a3d67658f916' 
  AND (
    token = 'ILp2DwfmY8DXnY5KC1Q+RoZWaNxmyODVj1Iu/yOsdLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023