UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8swxclOgO88CkXK5NJ9biOhvKf1gxoKvotk0otc2tM='
WHERE
key_id = '15763d8db74bacb00ee826e913e563e70e3999d9daeb5d6afd27087462ba656c'
AND (
token = 'N8swxclOgO88CkXK5NJ9biOhvKf1gxoKvotk0otc2tM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)