UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BlfQtUubYwgzYZy7YKKVslaA59MI5z1QT5fWuCaWuxs='
WHERE
key_id = 'a872ab4984fa398cc2d5dc31a9142aef301a6c5b6e446e32727d91269fce28f0'
AND (
token = 'BlfQtUubYwgzYZy7YKKVslaA59MI5z1QT5fWuCaWuxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)