UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6aQDeL7vMaJwRAsbmHnOFjVzG8A102OW1x6ma1FjnCk='
WHERE
key_id = '1d2e7da4ead149e3c80141a6ae36806e02c8b28985ae207e8c126dcaef372956'
AND (
token = '6aQDeL7vMaJwRAsbmHnOFjVzG8A102OW1x6ma1FjnCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)