UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3bjlBf9eKWabFa4ubeK6EnFq6JWjwXS7mxKI9nF9gxw='
WHERE
key_id = 'a856684dbbbb137664a8db4de2463bebdbb95fe23becdd64e07dd29d2cc89759'
AND (
token = '3bjlBf9eKWabFa4ubeK6EnFq6JWjwXS7mxKI9nF9gxw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)