UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dOusEvwH0jAfil5Zn+QUalHwSDJWJjiS20zOjC9d5w8='
WHERE
key_id = '9597acf482874f635e944f7cf8b5e656238c2d01f5eade51eca694b3f32d70cd'
AND (
token = 'dOusEvwH0jAfil5Zn+QUalHwSDJWJjiS20zOjC9d5w8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)