UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9zhiJ5ibcQqJTRZZNJY7DNxhecWVpoa2smr/H3p5xg='
WHERE
key_id = 'bd1b58a40d5272d0c508952573ae311215d2285fc80efec413a62eac84d4414a'
AND (
token = 'C9zhiJ5ibcQqJTRZZNJY7DNxhecWVpoa2smr/H3p5xg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)