UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C97M4JStiIVfQT/Br7VUUBMqv1xU7ViG4AD8xxlV5q8='
WHERE
key_id = '286681c7fe5334922ef18b569fa729fc5c34f7c50d6089210f245932b976c37b'
AND (
token = 'C97M4JStiIVfQT/Br7VUUBMqv1xU7ViG4AD8xxlV5q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)