UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6dxdllhuwm+3PKYpDTTjWcBxBLY9HSTWNZj1IlPRyLw='
WHERE
key_id = '646ad668d79c157eaa373d933d574f5e9fd2859949e7b4bed577689512d0741b'
AND (
token = '6dxdllhuwm+3PKYpDTTjWcBxBLY9HSTWNZj1IlPRyLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)