UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iGbFXd+JWqcj+zdwFVIApZaBKwK/1q/uJTlPZaeGJcM='
WHERE
key_id = 'a4ec9de0af01d435eb3e28a89d64a0584ff1615c3712876caa8f5a31811a10e2'
AND (
token = 'iGbFXd+JWqcj+zdwFVIApZaBKwK/1q/uJTlPZaeGJcM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)