UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thuTYmy2jhg3hOL1lwp7gaQrCQXFwHc8gxbUZlUJAOw='
WHERE
key_id = '6989bcf8f489728ce90843ab522a0f816b18243cb57d4c150afa29007b00eb80'
AND (
token = 'thuTYmy2jhg3hOL1lwp7gaQrCQXFwHc8gxbUZlUJAOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)