UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yQJOACEJpOSg8IhKKPcgDkB7NhBdcBIH60bxm5rANuk='
WHERE
key_id = 'a0c2e9b88eda61332e62d2b48702be69be57f61d957280930d6691f2e59b288b'
AND (
token = 'yQJOACEJpOSg8IhKKPcgDkB7NhBdcBIH60bxm5rANuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)