UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wLD5A2StGwioIOafPcfSU1md/kegnPdMZzARhQebsbU=' 
WHERE 
  key_id = '50f112ca4c3f8902a3cf6d5685e826c486505c0bdecd07f88563563b9c5f6a5d' 
  AND (
    token = 'wLD5A2StGwioIOafPcfSU1md/kegnPdMZzARhQebsbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031