UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50meFFqkUTqxBRAb4dssfBSkjF5YKy0r7hrFMaFYRD0='
WHERE
key_id = '356900644923f460209244a5c1eef4cdbccacb63ecde4259cbc45d0e813d5046'
AND (
token = '50meFFqkUTqxBRAb4dssfBSkjF5YKy0r7hrFMaFYRD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)