UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+u9V+QIUvQBVS9tAAqdoVIyc2+GOTmrX8PW3z7zjzuQ=' 
WHERE 
  key_id = 'd3175dd23d8b7d959e26200034609ae3002508a3ad52208298327247ede51160' 
  AND (
    token = '+u9V+QIUvQBVS9tAAqdoVIyc2+GOTmrX8PW3z7zjzuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041