UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J9AbHgbLOcIs8FzAhMprr3/jtr2+m0flGKvKNa3eCIU=' 
WHERE 
  key_id = 'affd50e8552cc0461eac9b54a889ed1acfa98bfa1369253cc287391fd7ad4d91' 
  AND (
    token = 'J9AbHgbLOcIs8FzAhMprr3/jtr2+m0flGKvKNa3eCIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020