UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GMW9BPwlj2KwQdgs0U7VpCMXjoErSD1b7ebeMWNljbI='
WHERE
key_id = '55d9cee0cbc86f220a7297ed5d132a507ddd1661088856bd8b9a52a98df631aa'
AND (
token = 'GMW9BPwlj2KwQdgs0U7VpCMXjoErSD1b7ebeMWNljbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)