UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zf7ScSY9f0D1PBWmdON4nufGuwQHkmRw/+vabaQrD9s='
WHERE
key_id = '5940c12604a234ffd28fb0fe37ae39e6be1074a76e9a1cb49eea6adbb8c32be3'
AND (
token = 'Zf7ScSY9f0D1PBWmdON4nufGuwQHkmRw/+vabaQrD9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)