UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bDlImMUjVJBqCYpv2NQkXp+vaGzt8q3M1jg58zfQMi0='
WHERE
key_id = 'fe369b04f2a4bca9982e17419e4a275ab32aed173ce49b1d9eb6753f1a5e6d14'
AND (
token = 'bDlImMUjVJBqCYpv2NQkXp+vaGzt8q3M1jg58zfQMi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)