UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SeMx5AgjhmYvf/E0m/zb0nrILk0bvGMjVogoipHcX0o='
WHERE
key_id = '9865e556a217a4a3e39317dfd31a0ac39a95783977f9a679ebb4ff2e367afbf9'
AND (
token = 'SeMx5AgjhmYvf/E0m/zb0nrILk0bvGMjVogoipHcX0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)