UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Shgn5mVk2ES14Z1AAEUvwDQGsfaDl1ki5NOoRrU5fvo=' 
WHERE 
  key_id = 'ce20bb36d992d4659feebb1ec292153650fec59e22e09f9d5d43edab797b9d0d' 
  AND (
    token = 'Shgn5mVk2ES14Z1AAEUvwDQGsfaDl1ki5NOoRrU5fvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021