UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sWzYnbZBkBOghKOLZSDN0ny4dvoi4i8Dc6V6jH5YlOk='
WHERE
key_id = '05ade7df04f3f26002eb7ca272283ec0c436d42a9dac6cb3649f56e72152ccac'
AND (
token = 'sWzYnbZBkBOghKOLZSDN0ny4dvoi4i8Dc6V6jH5YlOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)