UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9qfuSI0bgmjEe7YIm36UiBBBCJRz0BuovEE2x+wJxhk='
WHERE
key_id = 'cfa346976e75a616e5b868b758f581f69d2d8b9002a7b5967bdc8ad784e929ce'
AND (
token = '9qfuSI0bgmjEe7YIm36UiBBBCJRz0BuovEE2x+wJxhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)