UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DjkgxodIV1mQxbnx08Bfs0VJ2EZmS37y60Qba+lXKO0='
WHERE
key_id = 'c4449365ba05d91541c66bb487f0da6492214b838591461732bd926816c63794'
AND (
token = 'DjkgxodIV1mQxbnx08Bfs0VJ2EZmS37y60Qba+lXKO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)