UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYB8xOEkO7tvurmKs6ZmDK1ohEV53ZFbihzC+34CVRg='
WHERE
key_id = 'a91303284e2ee90ded189ea9a1cabf8ea81f48c78e3e569c67184d1fdd267b7d'
AND (
token = 'xYB8xOEkO7tvurmKs6ZmDK1ohEV53ZFbihzC+34CVRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)