UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3W0tsEq9aORs//PPpeJToHXUMdeuUYNuRDHQ08g+kJk=' 
WHERE 
  key_id = '12bc213d47278a6c6600ad01f978b7e818599600a29982d1979433d62666a675' 
  AND (
    token = '3W0tsEq9aORs//PPpeJToHXUMdeuUYNuRDHQ08g+kJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033