UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZtYy4cc6VqbxocaDKFh+5uoiSwBHjYqXSjyu8Hdjmc4='
WHERE
key_id = '92d1c21d28a62cf3639ca706092c42ecd39e460628298b394584110b74a3d939'
AND (
token = 'ZtYy4cc6VqbxocaDKFh+5uoiSwBHjYqXSjyu8Hdjmc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)