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