UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KA7X+aeEfMY7hGV3ZpWw6dPAqHczQ/gmHc4P7Gd695Q='
WHERE
key_id = '7a17c85a0a5b4ae746081c219620719bd67b9af41187184864f05b731230af78'
AND (
token = 'KA7X+aeEfMY7hGV3ZpWw6dPAqHczQ/gmHc4P7Gd695Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)