UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R/xT62BjdJTpKrMv+O15wrnxpYZpOrWPhgfcfUJDHE8=' 
WHERE 
  key_id = '7817ac581f21fe229bd73b19c189a940f9f60236c85e0aa7ff016d84cecd1505' 
  AND (
    token = 'R/xT62BjdJTpKrMv+O15wrnxpYZpOrWPhgfcfUJDHE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041